<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /*
          集合
          \d [0-9]
          \db [0b-9b]
          \w[0-9][a-z][A-Z]_
          */
      const str = "a1 a-b2b  a1c1b a3bd";
      //   const reg = /1b/g;
      //   const reg = /\db/g; // \d[0b-9b]
      //   const reg = /\sa/g; // \d [0-9]
      //   const reg = /\w/g; //  \w[0-9][a-z][A-Z]_
      //   const reg = /\D/g; // != [0-9]
      //   const reg = /\S/g; //
      const reg = /\W/g; //
      // match根据正则表达式匹配字符，返回匹配结果
      console.log(str.match(reg));
    </script>
  </body>
</html>
